﻿@model IList<AntJob.Data.Entity.App>
@using NewLife;
@using NewLife.Web;
@using XCode;
@using XCode.Configuration;
@{
    var fact = ViewBag.Factory as IEntityFactory;
    var page = ViewBag.Page as Pager;
    var fields = ViewBag.Fields as IList<FieldItem>;
    var set = ViewBag.PageSetting as PageSetting;
    var provider = ManageProvider.Provider;
}
<table class="table table-bordered table-hover table-striped table-condensed">
    <thead>
        <tr>
            @if (set.EnableSelect)
            {
                <th class="text-center" style="width:10px;"><input type="checkbox" id="chkAll" title="全选" /></th>
            }
            <th class="text-center hidden-md hidden-sm hidden-xs"><a href="@Html.Raw(page.GetSortUrl("ID"))">编号</a></th>
            <th class="text-center"><a href="@Html.Raw(page.GetSortUrl("Name"))">名称</a></th>
            <th class="text-center"><a href="@Html.Raw(page.GetSortUrl("DisplayName"))">显示名</a></th>
            <th class="text-center"><a href="@Html.Raw(page.GetSortUrl("MessageCount"))">消息数</a></th>
            <th class="text-center"><a href="@Html.Raw(page.GetSortUrl("JobCount"))">作业数</a></th>
            <th class="text-center"><a href="@Html.Raw(page.GetSortUrl("Enable"))">启用</a></th>
            <th class="text-center">消息</th>
            <th class="text-center">在线</th>
            <th class="text-center">任务</th>
            <th class="text-center">错误</th>
            <th class="text-center">配置</th>
            <th class="text-center">历史</th>
            <th class="text-center" style="min-width:134px;"><a href="@Html.Raw(page.GetSortUrl("UpdateTime"))">更新时间</a></th>
            @if (this.Has(PermissionFlags.Detail, PermissionFlags.Update, PermissionFlags.Delete))
            {
                <th class="text-center" style="min-width:100px;">操作</th>
            }
        </tr>
    </thead>
    <tbody>
        @foreach (var entity in Model)
        {
            <tr>
                @if (set.EnableSelect)
                {
                    <td class="text-center"><input type="checkbox" name="keys" value="@entity.ID" /></td>
                }
                <td class="text-center hidden-md hidden-sm hidden-xs">@entity.ID</td>
                <td class="text-center"><a href="@Url.Action("Index","Job",new {appid=entity.ID})">@entity.Name</a></td>
                <td>@entity.DisplayName</td>
                <td>@entity.MessageCount.ToString("n0")</td>
                <td class="text-center"><a href="@Url.Action("Index","Job",new {appid=entity.ID})">@entity.JobCount</a></td>
                <td class="text-center">
                    <a href="App/Set/@entity.ID?enable=@(entity.Enable?"false":"true")" data-action="action"><i class="glyphicon glyphicon-@(entity.Enable ? "ok" : "remove")" style="color: @(entity.Enable ? "green" : "red");"></i></a>
                </td>
                <td class="text-center"><a href="@Url.Action("Index","AppMessage",new {appid=entity.ID})">消息</a></td>
                <td class="text-center"><a href="@Url.Action("Index","AppOnline",new {appid=entity.ID})">在线</a></td>
                <td class="text-center"><a href="@Url.Action("Index","JobTask",new {appid=entity.ID})">任务</a></td>
                <td class="text-center"><a href="@Url.Action("Index","JobError",new {appid=entity.ID})">错误</a></td>
                <td class="text-center"><a href="AppConfig?appId=@entity.ID">配置</a></td>
                <td class="text-center"><a href="AppHistory?appId=@entity.ID">历史</a></td>
                <td>@entity.UpdateTime.ToFullString("")</td>
                @if (this.Has(PermissionFlags.Detail, PermissionFlags.Update, PermissionFlags.Delete))
                {
                    <td class="text-center">
                        @await Html.PartialAsync("_List_Data_Action", (Object)entity)
                    </td>
                }
            </tr>
        }
    </tbody>
</table>